Discover linux command line and shell scripting bible, include the articles, news, trends, analysis and practical advice about linux command line and shell scripting bible on alibabacloud.com
127Command not found the -Invalid exit Argument the -+x Fatal error with Linux signal x - theCommand terminated with ctl-C - 255Exit status outof Range the the+Exit Command the 1. can change this toreturnyour own exit status code. The Exit command the allows you to specify a exit status when your script ends: - (DO) theres=$[$a +$b] theExit5 theWhen checking exit code for the above program $?=5, you can
contains the information and location of the source file. Referencing a hard-link file is equivalent to referencing a source fileCp-l test1 test4The-l parameter creates a hard-link test4 that points to the file test1.Note: You can only create hard links between files on the same storage media, and you cannot create hard links between files under different mount points.The parameter-s creates a symbolic link, or a soft connectionCp-s Test TEST5When copying a linked file, be aware that if you use
to customize their command aliases and private script functions3. non-interactive shellThis is the shell used by the system to execute shell scripts.There is no command line prompt.Bash shell provides bash_env environment variables. When a non-interactive shell is started,
directly behind the. BASHRCfunction Addem{Echo $[$ [+ $]}This function is used anywhere on the system.2. Reading function filesYou can use the source command to add a function from the library file to the. BASHRCAdd it directly behind the. BASHRC. /home/xcy/myfuncsSo you can use the function inside the Myfuncs.17.8 exampleThis section describes the GNU Shtool Shell script function library. The Shtool library provides a few simple
The first part of the Linux command lineThe 1th chapter of the first knowledge of Linux she1.1 What is Linux 21.1.1 Deep Dive into Linux kernel 31.1.2 GNU Tools 61.1.3 Linux Desktop Environment 81.2 Linux Release 121.2.1 Core
.2) read uses the IFS character to parse the text, and here we specify the IFS as a comma.Cat >> $outfile This includes an output append redirect (>>) and an input append redirect (>> appends the output of the cat command to the file specified by the $outfile variable.The input to the Cat command is not taken from standard input, but is redirected to the data stored in the script.The EOF symbol marks the beginning and end of the data appended to the file.Input file + run + Result:DescriptionSpe
specified shell command
V
Start the VI editor with the current file
.
Repeat the previous command
N
Find in file the overflow matches the content of the specified expression
‘
Jumps to the first content that the specified expression matches to
Ctrl+l
Redraw the current scre
"
Else
echo "$val ^ 2
Fi
Str1=xcyhaha
if [[$str 1 = = xcy*]]
Then
echo "str1 = = xcy*, str1 is $str 1"
Else
echo "STR1! = xcy*, str1 is $str 1"
Fi
12.7 Case CommandWith the case command, you don't have to write all the elif statements to keep checking the value of the same variable.The case command takes a list format to examine multiple values for a single variable.Syntax: Note the two semicolons that followCase variable inPattern1 | PATTERN2)
2017 09:48:22 +0800from localhost [127.0.0.1]-----The following addresses had permanent fatal errors-----[email protected]>(reason:550 Failed to connect remote host.)-----Transcript of Session follows-----... while talking to mx3.qq.com.:... while talking to mx2.qq.com.:So the machine was restarted a bit. You can do it.[Email protected]:/var/mail$ Echo]20171204tete" | Mail-s "TEst2"Xcy[Email protected]:/var/mail$ Mail"/var/mail/xcy": 3 messages 1 new 2 unreadU 1 Mail Delivery Subs December 4 10
-be-sustained by perpetual neglect of many and other things. Robert Louis Stevenson (1850-1894)
[Email protected]:~/shell/26zhang$
Note this:#grep "$ (date +%b '%-d, '%Y)"-A2 |Since my Ubuntu is in Chinese, I have not been searching for November. I'm going to replace it with this one, only 28, 2017.grep ", $ (date +%y)"-a2 | # Xcy AddIt would have been like this grep "$ (date +%-d, '%Y)"-A2 | # xcy Add, don't know why my date is 29. And the site is
fileYou can also connect many parameters.such as Sort-t ': '-K 3 testYou can think of it as something inside. xxx1:xxx2:xxx3:xxx4:xxx5means to sort the xxx3-T: Specifies a character to distinguish the key position-K:--key=pos1[pos1]. The sort starts with pos1, and if POS2 is specified, it ends at Pos2.| Redirects the output of the du command to the sort command.-r: Indicates descending order.Here is an example:4.3.21. grep [options] pattern [file]For example:grep t test//Search for text in test
Previous Edit CommandA: Append data after the current cursorO: The next line of the cursor inserts dataDW Delete a Wordd$ Delete to end of lineDD: Delete Row, 5dd delete 5 rowsThe use of backspace and delete keys in normal mode is not recognized.10.1.4 Copy and pasteDD can be pasted with p after deletion.The copy command is Y,YW copy a wordy$ Copy to end of lineThen use p to paste10.1.5 Find Replacement: s/old/new/g a
Linux comm command line tool-general Linux technology-Linux technology and application information, the following is a detailed description. If you want to compare the content of the two text files in Linux Command
From a programmer's point of view, the shell itself is a program written in C language, from the user's point of view, the shell is the user and the Linux operating system communication Bridge. Users can either enter command execution and use shell scripting to accomplish mo
Tags: shell multi-line redirection1. What is the problem requirement?First, the need to come from, mainly to write shell script, with cat for multi-line input redirection, the Terminator must be hyphenation first, the format is not good-looking.2, how? How to solve this problem?First Baidu, Google search the next, the
:07Variables in shell scripts
You should use a variable instead when you use a string more frequently in your script and the string length is long
When using conditional statements, variables are often used?? If [$a-gt 1]; Then ...; Fi
When referencing the result of a command, replace it with a variable?? n=wc -l 1.txt
When writing scripts for user interaction, variables are also necessary?? Read-p "Input a number:" N; echo $n?? I
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.